package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;
import com.daoeping.domain.Bsc_grade;
import com.daoeping.domain.JsonData;
import com.daoeping.service.GradeService;
import com.daoeping.util.ConverntJsonData;


public class GradeAction {
	
	
	private GradeService gradeService;
	private JsonData jsonData;
	private List<Bsc_grade> gradeList;
	
	public List<Bsc_grade> getGradeList() {
		return gradeList;
	}

	public void setGradeList(List<Bsc_grade> gradeList) {
		this.gradeList = gradeList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}



	public GradeService getGradeService() {
		return gradeService;
	}

	public void setGradeService(GradeService gradeService) {
		this.gradeService = gradeService;
	}

	public String findAllGrade(){
		jsonData = new JsonData();
		gradeList = gradeService.findBsc_grades();		
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_grade bsc_grade : gradeList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_grade.getId()+"";
			strarr[0] = bsc_grade.getName();
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "allgrades";
		
	}
}
